<?php

namespace App\Services\Authcode;

use App\Services\Authcode\Authcode\AuthcodeLogic;


/**
 * Class Authcode 验证码服务层入口
 * @package App\Services\User
 */
class Authcode {

    public function createAuthCode($data = [])
    {
        if (empty($data)) {
            return null_data($data,"参数不能为空！");
        }

        return (new AuthcodeLogic())->checkRepeat($data);
    }

    public function verifyAuthCode($data = [])
    {
        if (empty($data)) {
            return null_data($data,"参数不能为空！");
        }
         $data['appkey'] = $app_key = config('tpproject.yayi_admin_app_key');
         $data = init_array($data,["token"=>"", "appkey"=>"", "type"=>"", "code_id"=>"", "auth_code"=>""]);
        ValidateAuthcode::checkValidate($data, ["type","code_id","auth_code"]);
        return (new AuthcodeLogic())->verifyAuthCode($data);
    }

}